home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / readline.lha / readline / Makefile < prev    next >
Makefile  |  1991-05-01  |  4KB  |  128 lines

  1. ## -*- text -*- ####################################################
  2. #                                   #
  3. # Makefile for readline and history libraries.               #
  4. #                                   #
  5. ####################################################################
  6.  
  7. # Here is a rule for making .o files from .c files that doesn't force
  8. # the type of the machine (like -sun3) into the flags.
  9. .c.o:
  10.     $(CC) -c $(CFLAGS) $(LOCAL_INCLUDES) $(CPPFLAGS) $*.c
  11.  
  12. # Destination installation directory.  The libraries are copied to DESTDIR
  13. # when you do a `make install', and the header files to INCDIR/readline/*.h.
  14. DESTDIR = /usr/local/lib
  15. INCDIR = /usr/local/include
  16.  
  17. # Define TYPES as -DVOID_SIGHANDLER if your operating system uses
  18. # a return type of "void" for signal handlers.
  19. TYPES = -DVOID_SIGHANDLER
  20.  
  21. # Define USG as -DUSG if you are using a System V operating system.
  22. #USG = -DUSG
  23.  
  24. # HP-UX compilation requires the BSD library.
  25. #LOCAL_LIBS = -lBSD
  26.  
  27. # Xenix compilation requires -ldir -lx
  28. #LOCAL_LIBS = -ldir -lx
  29.  
  30. # Comment out "-DVI_MODE" if you don't think that anyone will ever desire
  31. # the vi line editing mode and features.
  32. READLINE_DEFINES = $(TYPES) -DVI_MODE
  33.  
  34. DEBUG_FLAGS = -g
  35. LDFLAGS = $(DEBUG_FLAGS) 
  36. CFLAGS = $(DEBUG_FLAGS) $(USG) -I.
  37.  
  38. # A good alternative is gcc -traditional.
  39. #CC = gcc -traditional
  40. CC = cc
  41. RANLIB = /usr/bin/ranlib
  42. AR = ar
  43. RM = rm
  44. CP = cp
  45.  
  46. LOCAL_INCLUDES = -I../
  47.  
  48. CSOURCES = readline.c history.c funmap.c keymaps.c vi_mode.c \
  49.        emacs_keymap.c vi_keymap.c
  50.  
  51. HSOURCES = readline.h chardefs.h history.h keymaps.h
  52. SOURCES  = $(CSOURCES) $(HSOURCES)
  53.  
  54. DOCSOURCE = doc/rlman.texinfo doc/rltech.texinfo doc/rluser.texinfo \
  55.         doc/hist.texinfo doc/hsuser.texinfo doc/hstech.texinfo
  56. DOCOBJECT = doc/readline.dvi doc/history.dvi
  57. DOCSUPPORT = doc/Makefile doc/texinfo.tex
  58. DOCUMENTATION = $(DOCSOURCE) $(DOCOBJECT) $(DOCSUPPORT)
  59.  
  60. SUPPORT = COPYING Makefile $(DOCUMENTATION) ChangeLog examples
  61.  
  62. THINGS_TO_TAR = $(SOURCES) $(SUPPORT)
  63.  
  64. ##########################################################################
  65.  
  66. all: libreadline.a
  67.  
  68. libreadline.a:    readline.o history.o funmap.o keymaps.o
  69.     $(RM) -f libreadline.a
  70.     $(AR) clq libreadline.a readline.o history.o funmap.o keymaps.o
  71.     -if [ -f $(RANLIB) ]; then $(RANLIB) libreadline.a; fi
  72.  
  73. readline.o:    readline.c readline.h chardefs.h  keymaps.h history.h vi_mode.c
  74.     $(CC) -c $(CFLAGS) $(CPPFLAGS) $(READLINE_DEFINES) \
  75.       $(LOCAL_INCLUDES) $*.c
  76.  
  77. history.o:    history.c history.h
  78.     $(CC) -c $(CFLAGS) $(CPPFLAGS) $(READLINE_DEFINES) \
  79.       $(LOCAL_INCLUDES) $*.c
  80.  
  81. funmap.o:    funmap.c readline.h
  82.     $(CC) -c $(CFLAGS) $(CPPFLAGS) $(READLINE_DEFINES) \
  83.       $(LOCAL_INCLUDES) $*.c
  84.  
  85. keymaps.o:    keymaps.c emacs_keymap.c vi_keymap.c keymaps.h chardefs.h
  86.     $(CC) -c $(CFLAGS) $(CPPFLAGS) $(READLINE_DEFINES) \
  87.       $(LOCAL_INCLUDES) $*.c
  88.  
  89. libtest:    libreadline.a libtest.c
  90.     $(CC) -o libtest $(CFLAGS) $(CPPFLAGS) \
  91.      -L. libtest.c -lreadline -ltermcap
  92.  
  93. readline: readline.c history.o keymaps.o funmap.o readline.h chardefs.h
  94.     $(CC) $(CFLAGS) $(CPPFLAGS) $(READLINE_DEFINES) \
  95.       $(LOCAL_INCLUDES) -DTEST -o readline readline.c funmap.o \
  96.       keymaps.o history.o -L. -ltermcap
  97.  
  98. documentation: force
  99.     (cd doc; make)
  100. force:
  101.  
  102. readline.tar:    $(THINGS_TO_TAR)
  103.     tar -cf readline.tar $(THINGS_TO_TAR)
  104.  
  105. readline.tar.Z:    readline.tar
  106.     compress -f readline.tar
  107.  
  108. install:    $(DESTDIR)/libreadline.a includes
  109.  
  110. # The rule for 'includes' is written funny so that the if statement
  111. # always returns TRUE unless there really was an error installing the
  112. # include files.
  113. includes:
  114.     if [ -r $(INCDIR)/readline ]; then \
  115.       :; \
  116.     else \
  117.       mkdir $(INCDIR)/readline && chmod a+r $(INCDIR)/readline; \
  118.     fi
  119.     $(CP) readline.h keymaps.h chardefs.h $(INCDIR)/readline/
  120. clean:
  121.     rm -f *.o *.a
  122.     (cd doc; make clean)
  123.  
  124. $(DESTDIR)/libreadline.a: libreadline.a
  125.     -mv $(DESTDIR)/libreadline.a $(DESTDIR)/libreadline.old
  126.     cp libreadline.a $(DESTDIR)/libreadline.a
  127.     if [ -f $(RANLIB) ]; then $(RANLIB) -t $(DESTDIR)/libreadline.a; fi
  128.